#include <stdio.h>
#include <unistd.h>


#define REGS_FOREACH(_)  _(X)  _(Y)     // X on bit1, Y on bit0

#define RUN_LOGIC       X1 = (Y) ? (!X & Y) : (X) ; \
                        Y1 = !Y;

#define DEFINE(X)       static int X, X##1;
#define UPDATE(X)       X = X##1;
#define PRINT(X)        printf(#X " = %d; ", X);

int main()
{
    int i=9;
    REGS_FOREACH(DEFINE);
    while(i--){
        RUN_LOGIC;
        REGS_FOREACH(PRINT);
        REGS_FOREACH(UPDATE);
        putchar('\n'); sleep(1);
    }

    return 0;
}


